aHTMLSTR =  '<script type="text/javascript"><!--google_ad_client = "pub-1036318490403542"; google_ad_slot = "8464056649"; google_ad_width = 120; google_ad_height = 600;//--></script>';
aHTMLSTR += '<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>';
chat = [];
chatout = [];
keywords = ['book','puter','phone','multiplayer','game','pills','cialis','viagra','erection','gambling','casino','poker','insurance','stock','market','ultram','tramadol','xanax','valium','levitra','payday','betting','card','purchase','war','military'];
chatsrc = ['card games','gambling','risk game strategy ','gambling casino ', 'poker' , 'bored', 'strategy luck game', 'marketing', 'flash games', 'video games', 'ajax games', 'military strategy', 'military games', 'military war', 'war games'];

time = 900000;
//time = 5000;

function setAHTML(slot,height,width) {
 height = height - 200;
 aHTMLSTR =  '<script type="text/javascript"><!--google_ad_client = "pub-1036318490403542"; google_ad_slot =';
 aHTMLSTR += slot;
 aHTMLSTR+= '; google_ad_width = '+width+'; google_ad_height = '+(height-10)+';//--></script>';
 aHTMLSTR += '<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>';
 document.getElementById("ads").style.height=(height)+'px';
}
function refresh_ahtml(divid) {
  try {
  window.frames[divid].document.innerHTML='';
  //document.getElementById(divid).contentDocument.style.innerHTML = '#000;';
  } catch (err) { return; }
  //chatinfo = MLTags(document.getElementById('chat').innerHTML);
  cont = "";
  //window.frames[divid].document.innerHTML=aHTMLSTR+"<div style='left: 0px;'>"+chatinfo+"</div>";
  	for (y=0;y<chat.length;y++) {
	  for (x=0;x< keywords.length;x++) {
  		if (chat[y].indexOf(keywords[x])!=-1) {
  			chatout.push(chat[y]);
  			break;
  		}
  	}
  } 
  if (chatout.length==0)  {
    chatout.push(chatsrc[parseInt(chatsrc.length*Math.random())]);
    chatout.push(chatsrc[parseInt(chatsrc.length*Math.random())]);
  } else {
  	
  }
    cont=chatout.join().toLowerCase();
  //cont = cont.replace("%20"," ");
  window.frames[divid].location = "ads.html?context="+cont;
  chat = [];
  chatout=[];
  //window.frames[divid].location.reload(true);
  //document.getElementById(divid).contentDocument.innerHTML=aHTMLSTR+"<div style='left: 0px;'>"+chatinfo+"</div>";
  //document.getElementById(divid).contentDocument.location.reload(true);
  rpm = (Math.random()*60*7*1000)-4*60*1000;
  timedRefresh(divid,time+rpm);
}


function timedRefresh(divid,time) {
	setTimeout("refresh_ahtml('"+divid+"');",time);
}


function receivechatlog(tt) {
   if (tt==null) return;
   if (tt.replace(/<\/?[^>]+(>|$)/g, " ")!='undefined') {
   chat.push((tt.replace(/<\/?[^>]+(>|$)/g, " "))+" ");
   //if (chat.length>50) chat.pop();
   }
}
//strInputCode.replace(/<\/?[^>]+(>|$)/g, "");

function ads_load() {
if (navigator.appVersion.indexOf("iPhone")!=-1) {
	document.getElementById("adsdiv").innerHTML = "";
	ADSENSE=false;
} else
timedRefresh('ads',time);
}
//try {
//setTimeout("ads_load();",10000);
//} catch (err) { handle_silently(err); }
